//导入 vue  vuex
import Vue from "vue";

import Vuex from "vuex"


//注册vuex

Vue.use(Vuex)


//实例化,得到仓库

const store = new Vuex.Store({
  strict: process.env.NODE_ENV === 'development',
  state: {
    money: 10000,
    cay: 1000
  },
  mutations: {
    addMbMoney(state) {
      state.money++
    },
    addMoney(state, val) {
      state.money += val
    },
    addfn(state, payload) {
      state.money -= payload.aa
      state.cay -= payload.bb
    },
    addT(state, money) {
      state.money -= money
    }
  },
  actions: {
    addTt(context, money) {
      setTimeout(() => {
        context.commit('addT', money)
      }, 1000)
    }
  }
})

//导出store 

export default store